<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>学校管理</title>
	<meta name="decorator" content="default"/>
    <link href="${ctxStatic}/bootstrap/plugins/chose/chosen.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div class="main-content">
    <tags:breadcrumb menuId="添加学校" />
    <div class="page-content">
        <form:form id="inputForm" modelAttribute="school" enctype="multipart/form-data" action="${ctx}/school/school/save" method="post" class="form-horizontal">
            <form:hidden path="id"/>
            <div class="form-group">
                <label class="col-sm-1 no-padding-right control-label">学校名称：</label>
                <div class="col-sm-3">
                    <form:input path="schoolName" htmlEscape="false" maxlength="64" class="col-sm-10 "/>
                    <span class="important">*</span>
                </div>
                <label class="col-sm-1 no-padding-right control-label">国标：</label>
                <div class="col-sm-3">
                    <form:input path="schoolCode" htmlEscape="false" maxlength="32" class="col-sm-10 "/>
                    <span class="important">*</span>
                </div>
                <label class="col-sm-1 no-padding-right control-label">省标：</label>
                <div class="col-sm-3">
                    <form:input path="schoolCodeSn" htmlEscape="false" maxlength="20" class="col-sm-10 "/>
                    <span class="important">*</span>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-1 no-padding-right control-label">创建时间：</label>
                <div class="col-sm-3">
                    <input name="buildDate" type="text" readonly="readonly" maxlength="20" class="col-sm-6 Wdate required"
                           value="${school.buildDate}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
                    <span class="important">*</span>
                </div>
                <label class="col-sm-1 no-padding-right control-label">学校logo：</label>
                <div class="col-sm-3">
                    <input type="hidden" name="schoolLogo" id="schoolLogo" value="${school.schoolLogo}"/>
                    <tags:ckfinder input="schoolLogo" type="images" uploadPath="/logo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
                    <span class="important">*</span>
                </div>
                <label class="col-sm-1 no-padding-right control-label">学校宣传图：</label>
                <div class="col-sm-3">
                    <input type="hidden" name="schoolBanner" id="schoolBanner" value="${school.schoolBanner}"/>
                    <tags:ckfinder input="schoolBanner" type="images" uploadPath="/banner" selectMultiple="false" maxWidth="100" maxHeight="100"/>
                    <span class="important">*</span>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-1 no-padding-right control-label">省：</label>
                <div class="col-sm-3">
                    <form:select path="provice" cssClass="chosen-select col-sm-8 required">
                        <form:option value="" label="---请选择省份---"/>
                        <form:options items="${provinceList}" itemLabel="name" itemValue="id"/>
                    </form:select>
                    <span class="important">*</span>
                </div>
                <label class="col-sm-1 no-padding-right control-label">市：</label>
                <div class="col-sm-3">
                    <form:select path="city" cssClass="col-sm-8 required">
                        <form:option value="" label="---请选择市---"/>
                    </form:select>
                    <span class="important">*</span>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-1 no-padding-right control-label">学校特征：</label>
                <div class="col-sm-11">
                    <div style="padding-top:6px;">
                        <label style="margin-right: 10px;">
                            <input name="flag211" type="checkbox" class="ace" value="1"/>
                            <span class="lbl"> 是否211</span>
                        </label>
                        <label style="margin-right: 10px;">
                            <input name="flag985" type="checkbox" class="ace" value="1"/>
                            <span class="lbl"> 是否985</span>
                        </label>
                        <label style="margin-right: 10px;">
                            <input name="flagGuo" type="checkbox" class="ace" value="1"/>
                            <span class="lbl"> 是否有国防生</span>
                        </label>
                        <label style="margin-right: 10px;">
                            <input name="flagYan" type="checkbox" class="ace" value="1"/>
                            <span class="lbl"> 是否有研究生院</span>
                        </label>
                        <label style="margin-right: 10px;">
                            <input name="flagZhuo" type="checkbox" class="ace" value="1"/>
                            <span class="lbl"> 是否属于卓越计划</span>
                        </label>
                        <label style="margin-right: 10px;">
                            <input name="flagZi" type="checkbox" class="ace" value="1"/>
                            <span class="lbl"> 是否自主招生</span>
                        </label>
                    </div>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-1 no-padding-right control-label">隶属：</label>
                <div class="col-sm-3">
                    <form:input path="owns" htmlEscape="false" maxlength="32" class="col-sm-10 "/>
                    <span class="important">*</span>
                </div>
                <label class="col-sm-1 no-padding-right control-label">学校类型：</label>
                <div class="col-sm-3">
                    <form:select path="schoolType" cssClass="col-sm-10 required chosen-select">
                        <form:option value="" label="---请选择学校类型---"/>
                        <form:options items="${fns:getDictList('school_type')}" itemValue="value" itemLabel="label"/>
                    </form:select>
                    <span class="important">*</span>
                </div>
                <label class="col-sm-1 no-padding-right control-label">办学性质：</label>
                <div class="col-sm-3">
                    <form:select path="bxType" cssClass="col-sm-10 required chosen-select">
                        <form:option value="" label="---请选择办学类型---"/>
                        <form:options items="${fns:getDictList('bx_type')}" itemValue="value" itemLabel="label"/>
                    </form:select>
                    <span class="important">*</span>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-1 no-padding-right control-label">硕士点：</label>
                <div class="col-sm-3">
                    <form:input path="masterPoint" htmlEscape="false" maxlength="11" class="col-sm-10 " placeholder="硕士点个数"/>
                </div>
                <label class="col-sm-1 no-padding-right control-label">博士点：</label>
                <div class="col-sm-3">
                    <form:input path="doctorPoint" htmlEscape="false" maxlength="11" class="col-sm-10 " placeholder="博士点个数"/>
                </div>
                <label class="col-sm-1 no-padding-right control-label">重点学科数：</label>
                <div class="col-sm-3">
                    <form:input path="zdxkNum" htmlEscape="false" maxlength="11" class="col-sm-10 " placeholder="重点学科数个数"/>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-1 no-padding-right control-label">名次：</label>
                <div class="col-sm-3">
                    <form:input path="schoolRanking" htmlEscape="false" maxlength="11" class="col-sm-5 digits" placeholder="理科"/>&nbsp;&nbsp;
                    <form:input path="schoolWenRank" htmlEscape="false" maxlength="11" class="col-sm-5 digits" placeholder="文科"/>
                    <span class="important">*</span>
                </div>
                <label class="col-sm-1 no-padding-right control-label">标签：</label>
                <div class="col-sm-7">
                    <form:input path="schoolLabels" htmlEscape="false" maxlength="64" class="col-sm-8"/>
                    <span class="important">*</span>
                    <span class="help-inline">多个标签用"|"隔开</span>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-1 no-padding-right control-label">男生比例：</label>
                <div class="col-sm-3">
                    <form:input path="male" htmlEscape="false" class="col-sm-10" placeholder="30%"/>
                </div>
                <label class="col-sm-1 no-padding-right control-label">女生比例：</label>
                <div class="col-sm-3">
                    <form:input path="female" htmlEscape="false" class="col-sm-10"  placeholder="70%"/>
                </div>
                <label class="col-sm-1 no-padding-right control-label">男女比例：</label>
                <div class="col-sm-3">
                    <form:input path="maleFemale" htmlEscape="false" maxlength="10" class="col-sm-10 "  placeholder="7/3"/>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-1 no-padding-right control-label">学校网址：</label>
                <div class="col-sm-5">
                    <form:input path="schoolUrl" htmlEscape="false" maxlength="64" class="col-sm-10 "/>
                </div>
                <label class="col-sm-1 no-padding-right control-label">招生网址：</label>
                <div class="col-sm-5">
                    <form:input path="zsUrl" htmlEscape="false" maxlength="64" class="col-sm-10 "/>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-1 no-padding-right control-label">电话：</label>
                <div class="col-sm-2">
                    <form:input path="schoolTel" htmlEscape="false" maxlength="20" class="col-sm-10 "/>
                </div>
                <label class="col-sm-1 no-padding-right control-label">地址：</label>
                <div class="col-sm-8">
                    <form:input path="schoolAddr" htmlEscape="false" maxlength="128" class="col-sm-10 "/>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-1 no-padding-right control-label">特色专业：</label>
                <div class="col-sm-5">
                    <form:input path="teseMajor" htmlEscape="false" maxlength="1024" class="col-sm-10 "/>
                </div>
                <label class="col-sm-1 no-padding-right control-label">重点专业：</label>
                <div class="col-sm-5">
                    <form:input path="zdMajor" htmlEscape="false" class="col-sm-10 "/>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-1 no-padding-right control-label">简介：</label>
                <div class="col-sm-11">
                    <form:input path="schoolDesc" htmlEscape="false" class="col-sm-10 "/>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-1 no-padding-right control-label">学费信息：</label>
                <div class="col-sm-11">
                    <form:input path="tuitionInfo" htmlEscape="false" maxlength="512" class="col-sm-10 "/>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-1 no-padding-right control-label">就业情况：</label>
                <div class="col-sm-11">
                    <form:input path="employInfo" htmlEscape="false" maxlength="512" class="col-sm-10 "/>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-1 no-padding-right control-label">招生章程：</label>
                <div class="col-sm-11">
                    <form:input path="zszcInfo" htmlEscape="false" maxlength="512" class="col-sm-10 "/>
                </div>
            </div><hr>
            <div class="form-actions">
                <shiro:hasPermission name="school:school:edit"><input id="btnSubmit" class="btn btn-primary" type="button" value="保 存"/>&nbsp;</shiro:hasPermission>
                <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
            </div>
        </form:form>
    </div>
</div>
<script src="${ctxStatic}/bootstrap/plugins/chose/chosen.jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $(".chosen-select").chosen();
        //省市级联
        $("#provice\\.id").change(function(){
            var provinceCode = $("#provice\\.id").val();
            if(provinceCode!=null && provinceCode!=""){
                //先清除现有的选项
                $("#city\\.id").children().not(":first").remove();
                $.post("${ctx}/sys/area/getByParentCode",{parentCode:provinceCode},function(data){
                    if(data.length>0){
                        var len = data.length;
                        for(var i = 0; i<len; i++){
                            $("#city\\.id").append('<option value="'+data[i].id+'">'+data[i].name+'</option>');
                        }
                    }
                });
            }
        });

        $("#btnSubmit").click(function(){
            if($("#inputForm").valid()){
                var url = "${ctx}/school/school/save";
                $.post(url,$("#inputForm").serialize(),function(data){
                    if(data.success){
                        showNote("success",function(){
                            window.location.href = "${ctx}/school/school/list";
                        },data.msg,"center");
                    }else{
                        showNote("error",function(){return false;},data.msg,"center");
                    }
                });
            }else{
                showNote("error",function(){return false;},"输入有误，请正确输入数据","center");
            }
        });
    });
</script>
</body>
</html>